#ifndef _OCPP_VolumeGridData_H__
#define _OCPP_VolumeGridData_H__

#include "VolumeExtent.h"
#include "VolumeOptions.h"

namespace OCPP
{
	namespace Volume
	{
		using NcGridDataList = std::vector<VolumeGridData>;

		class _volumeExport VolumeGridData
		{
		public:
			enum GridDataType
			{
				Type_Char,
				Type_Float,
				Type_Double,
			};

			virtual ~VolumeGridData() {}

			void copyFrom(const VolumeGridData& ncOutput);

			void resetMissingValue() {
				_fillValue.reset();
				_missingValue.reset();
			}
			bool isValid() const;

			void addDimension(String name) { _dimensions.push_back(name); }

			bool isValidValue(float value) const;

			void setType(GridDataType value) {
				_dataType = value;
			}
			GridDataType getType() { return _dataType; }

			const VolumeExtent& getExtent() const {
				return _VolumeExtent;
			}

			VolumeExtent& getExtent() {
				return _VolumeExtent;
			}

			size_t getSize() const;
			float getFloat(size_t i) const;

			void clampX();
			void reverseY();
			void reverseZ();

			void scaleAndOffset(float scale, float offset);
			void ClipIf(const VolumeOptions& options);

			Uint8Vector _vecChar;
			Uint16Vector _vecUint16;
			FloatVector _vecFloat;
			DoubleVector _vecDouble;
			StringVector _dimensions;

			String _unit;
			VolumeExtent _VolumeExtent;
			MissingValue _fillValue;
			MissingValue _missingValue;

			GridDataType _dataType = Type_Float;
		};
	}
}


#endif // !_OCPP_NcOptions_H__
